<?php
//Include database info
define("DB_HOST", "localhost");
define("DB_USER", "GoRSS_DBUser");
define("DB_PASS", "Jolc)lp}#u.;o0");
define("DB_NAME", "GoRSS_DB");

// Create new service for PHP Remoting as Class.
class login
{
    function login()
    {
        //Define the methodTable
$this->methodTable = array(
    "doLogin" => array(
        "description" => "Login to database.",
        "arguments" => array("login", "pass"),
        "access" => "remote"
    ),
    "safe_stripslashes" => array(
        "description" => "No description given.",
        "arguments" => array("buf"),
        "access" => "private"
    )
);
       
        //Connect to MySQL and select database
        $link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
        $db = mysql_select_db(DB_NAME, $link);
    }

   
    function doLogin($login, $pass)
    {
        $login = $this->safe_stripslashes($login);
        $pass = $this->safe_stripslashes($pass);
   
        $sql = "SELECT * FROM gorss_users WHERE uname='".addslashes($login)."' AND upass='".addslashes($pass)."'";
        // $sql = "SELECT * FROM gorss_users WHERE uname='gorss' AND upass='testtest'";
        $result = mysql_query($sql);
        $row = mysql_fetch_assoc($result);
        // return $row["uid"];
        if($login == $row["uname"] && $pass == $row["upass"]) {
        	return true;
        } else {
        	return false;
        }
    }
   
    function safe_stripslashes ($buf)
    {
        // find this out yourself ;)
       
        return $buf;
    }
}
?>